package com.smarttiger.zero.admin.entity;


import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

@MappedSuperclass
public class BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    BaseEntity(){
        this.setId(UUID.randomUUID().toString());
        this.setCreatDate(new Date());
    }

    @Id
    protected String id;

    @Column(name = "createDate")
    @Temporal(TemporalType.TIMESTAMP)
    protected Date createDate;

    @Column(name = "updateDate")
    @Temporal(TemporalType.TIMESTAMP)
    protected Date updateDate;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getCreatDate() {
        return createDate;
    }

    public void setCreatDate(Date creatDate) {
        this.createDate = creatDate;
    }

    public Date getUpdataDate() {
        return updateDate;
    }

    public void setUpdataDate(Date updataDate) {
        this.updateDate = updataDate;
    }
}
